/**
 * Collaborative Story Development Web Application (CSDApp) Copyright Anton
 * Strack 2014
 *
 * This file is part of Collaborative Story Development Application (CSDApp).
 *
 * CSDApp is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or any later version.
 *
 * CSDApp is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * CSDApp. If not, see <http://www.gnu.org/licenses/>.
 *
 */
package csdwa;

public class CSDAppFactory<T> {

    public CSDAppFactory() {
    }

    /**
     * This method creates the Resource factory responsible for creating all
     * resource types that will have respective DAO classes and thus are
     * "Models"
     *
     * @return the resourceFactory
     */
    public static ResourceFactory getResourceFactory() {
        return new ResourceFactory();

    }

    /**
     * This method returns the datasource used by the csd application. This
     * method should only be used for the AccessControl or DatabaseController
     * classes. Other classes needing database access should use
     * DatabaseController.
     *
     * @return a default configuration of the datasource
     */
    public static Datasource getDatasource(String basepath) {
        return new Datasource(Configuration.getDbURL(), Configuration.getDbUser(), Configuration.getDbPass(), basepath);
    }
}
